home *** CD-ROM | disk | FTP | other *** search
- Path: erich.triumf.ca!bennett
- From: bennett@erich.triumf.ca (P.Bennett)
- Newsgroups: comp.lang.c
- Subject: Re: Int to Double, Pl Advise!
- Date: 28 Mar 1996 22:16 PST
- Organization: TRIUMF: Tri-University Meson Facility
- Distribution: world
- Message-ID: <28MAR199622162855@erich.triumf.ca>
- References: <isa5224.544.315B647A@age2.age.uiuc.edu>
- NNTP-Posting-Host: erich.triumf.ca
- News-Software: VAX/VMS VNEWS 1.50
-
- In article <isa5224.544.315B647A@age2.age.uiuc.edu>, isa5224@age2.age.uiuc.edu (Irfan S. Ahmad) writes...
- >Hi:
- >
- >I am having problems with the following type conversion. From int to double.
- >If someone can comment:
- ....
- >int p0[Ng][Nr];
- >
- >int main(){
- >int i,j,k;
- >float x =0;
- >float y =0;
-
- >for (i=1; i<Ng; i++) {
- > for (j=1; j<Nr; j++) {
- >
- > x = x + ((double) p0[i,j]) / (double)(j*j); }
- ^^^^^
- This should probably be p0[i][j]
- >}
- >
- >I get the following compilation error(s) on MS C++ compiler:
- >error C2440: 'cast' : cannot convert from 'int [4]' to 'double '
-
- Peter Bennett VE7CEI | Vessels shall be deemed to be in sight
- Internet: bennett@triumf.ca | of one another only when one can be
- Packet: ve7cei@ve7kit.#vanc.bc.ca | observed visually from the other
- TRIUMF, Vancouver, B.C., Canada | ColRegs 3(k)
- GPS and NMEA info and programs: ftp://sundae.triumf.ca/pub/peter/index.html
- or: ftp://ftp-i2.informatik.rwth-aachen.de/pub/arnd/GPS/peter/index.html
-
-
-
-
-
-
-
-
-